

import React, { Component } from 'react';
import {
  Text,
  View,
  StyleSheet,
  Image
} from 'react-native';
import AntDesign from 'react-native-vector-icons/AntDesign';
class Nav extends Component {
  constructor(props) {
    super(props);
  }
  componentDidMount() {
  }
  // 返回上一页
  getParams() {
    if (this.props && this.props.navigation.canGoBack()) {
      this.props.navigation.goBack()
    } else {
      console.log('error')
    }
  }
  render() {
    return (
      <View style={styles.nav}>
        <AntDesign name="leftcircleo" color='#909090' size={20} onPress={() => { this.getParams(); }} />
        <Text >{this.props.title || '导航'}</Text>
        <Text ></Text>
      </View>
    );
  }
};

const styles = StyleSheet.create({
  nav: {
    flexDirection: 'row',
    justifyContent: "space-between",
    textAlign: 'center',
    fontWeight: "900",
    paddingVertical: 20,
    paddingHorizontal: '5%',
    width: '90%'
  }
});

export default Nav;
